﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using OpenPhotoAlbum.DbAccess;
using System.Globalization;

namespace OpenPhotoAlbum.BusinessLogics.Email
{
    public class EmailPasswordRecoveryContentBuilders: IEmailContentBuilder
    {
        private RecoveringRequest _request;

        public EmailPasswordRecoveryContentBuilders(RecoveringRequest request)
        {
            _request = request;
        }

        #region IEmailContentBuilder Members

        public string BuildSubject()
        {
            return Resources.Strings.Email_PasswordRecovery_Subject;
        }

        public string BuildBody()
        {
			string url = Links.ToFullPath(UrlContext.BuildPasswordRecoveryUrl(_request.RecoveringKey));

            string body = string.Format(
                CultureInfo.CurrentCulture,
                Resources.Strings.Email_PasswordRecovery_Content,
                AlbumPage.ApplicationName,
                url,
                EmailConfigReader.Instance.ReadAdminEmail());
            
            return body;
        }

        #endregion
    }
}
